package android.support.v4.os;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.os.RemoteException;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import o.ad;

@SuppressLint({"BanParcelableUsage"})
@RestrictTo({d.ॱ})
public class ResultReceiver implements Parcelable {
    public static final Creator<ResultReceiver> CREATOR = new Creator<ResultReceiver>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ˎ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ˎ(i);
        }

        public ResultReceiver ˎ(Parcel parcel) {
            return new ResultReceiver(parcel);
        }

        public ResultReceiver[] ˎ(int i) {
            return new ResultReceiver[i];
        }
    };
    final boolean ˊ = false;
    ad ˎ;
    final Handler ॱ = null;

    class a extends o.ad.e {
        final /* synthetic */ ResultReceiver ˎ;

        a(ResultReceiver resultReceiver) {
            this.ˎ = resultReceiver;
        }

        public void ˋ(int i, Bundle bundle) {
            if (this.ˎ.ॱ != null) {
                this.ˎ.ॱ.post(new e(this.ˎ, i, bundle));
            } else {
                this.ˎ.ˋ(i, bundle);
            }
        }
    }

    class e implements Runnable {
        final /* synthetic */ ResultReceiver ˊ;
        final int ˋ;
        final Bundle ˏ;

        e(ResultReceiver resultReceiver, int i, Bundle bundle) {
            this.ˊ = resultReceiver;
            this.ˋ = i;
            this.ˏ = bundle;
        }

        public void run() {
            this.ˊ.ˋ(this.ˋ, this.ˏ);
        }
    }

    public void ˊ(int i, Bundle bundle) {
        if (this.ˊ) {
            if (this.ॱ != null) {
                this.ॱ.post(new e(this, i, bundle));
            } else {
                ˋ(i, bundle);
            }
        } else if (this.ˎ != null) {
            try {
                this.ˎ.ˋ(i, bundle);
            } catch (RemoteException e) {
            }
        }
    }

    protected void ˋ(int i, Bundle bundle) {
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i) {
        synchronized (this) {
            if (this.ˎ == null) {
                this.ˎ = new a(this);
            }
            parcel.writeStrongBinder(this.ˎ.asBinder());
        }
    }

    ResultReceiver(Parcel parcel) {
        this.ˎ = o.ad.e.ॱ(parcel.readStrongBinder());
    }
}
